<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
			    xmlns:ui="http://java.sun.com/jsf/facelets"
			    xmlns:h="http://java.sun.com/jsf/html"
			    xmlns:f="http://java.sun.com/jsf/core"    
			    template="./template/template_login.xhtml">
    
    <ui:define name="title">
        Listado de Ingresos
    </ui:define>
    
    <ui:define name="content">        			
			<h:form id="listadoIngresosForm" styleClass="fields">								
				<f:event listener="#{receiptsBean.fillDropDowns}" type="preRenderView" />
								
				<div class="box box-100 altbox">
					<div class="boxin">
						<div class="header">
							<h3>Listado de Ingresos</h3>
							<h:commandLink action="#{receiptsBean.goAddReceipts}" value="Nuevo Ingreso" styleClass="button"/>		
						</div>
						
						<h:messages id="messages" errorClass="msg msg-error" infoClass="msg msg-info" />
						<h:panelGrid columns="8">
					  							  																						
							<h:outputLabel value="Condomino" />					
							<h:selectOneMenu id="condominoId" value="#{receiptsBean.condominiumsId}" >
									<f:selectItem itemValue="-1" itemLabel="- Seleccionar -" />
			  						<f:selectItems value="#{receiptsBean.condominiumsList}" />
							</h:selectOneMenu>	
																				
							<h:outputLabel value="Tipo de Ingreso:" />
							<h:selectOneMenu id="tipoIngreso" value="#{receiptsBean.receiptSearchType}" >
								<f:selectItems value="#{receiptsBean.receiptsList}" />
							</h:selectOneMenu>
							
							
							<h:outputLabel value="Mes:" />
							<h:selectOneMenu id="mesId" value="#{receiptsBean.receiptSearchMonth}" >
								<f:ajax render="@none" execute="@this" />
		                        <f:selectItem itemValue="1" itemLabel="Enero" />
		                        <f:selectItem itemValue="2" itemLabel="Febrero" />
		                        <f:selectItem itemValue="3" itemLabel="Marzo" />
		                        <f:selectItem itemValue="4" itemLabel="Abril" />
		                        <f:selectItem itemValue="5" itemLabel="Mayo" />
		                        <f:selectItem itemValue="6" itemLabel="Junio" />
		                        <f:selectItem itemValue="7" itemLabel="Julio" />
		                        <f:selectItem itemValue="8" itemLabel="Agosto" />
		                        <f:selectItem itemValue="9" itemLabel="Septiembre" />
		                        <f:selectItem itemValue="10" itemLabel="Octubre" />
		                        <f:selectItem itemValue="11" itemLabel="Noviembre" />
		                        <f:selectItem itemValue="12" itemLabel="Diciembre" />
							</h:selectOneMenu>
							
							<h:outputLabel value="A&#241;o:" />
							<h:selectOneMenu id="anioId" value="#{receiptsBean.receiptSearchYear}"  styleClass="campo_texto" >
								<f:ajax render="@none" execute="@this" />                        
		                        <f:selectItem itemValue="2010" itemLabel="2010" />
		                        <f:selectItem itemValue="2011" itemLabel="2011" />
		                        <f:selectItem itemValue="2012" itemLabel="2012" />
		                        <f:selectItem itemValue="2013" itemLabel="2013" />
		                        <f:selectItem itemValue="2014" itemLabel="2014" />
		                        <f:selectItem itemValue="2015" itemLabel="2015" />
		                        <f:selectItem itemValue="2016" itemLabel="2016" />
		                        <f:selectItem itemValue="2017" itemLabel="2017" />
		                        <f:selectItem itemValue="2018" itemLabel="2018" />
		                        <f:selectItem itemValue="2019" itemLabel="2019" />
		                        <f:selectItem itemValue="2020" itemLabel="2020" />
							</h:selectOneMenu>					
							
							<f:facet name="footer">
								<h:panelGroup>		  
								  &nbsp;&nbsp;<h:commandButton id="buscarId" styleClass="button altbutton" value="Buscar" action="#{receiptsBean.searchAction}" /> 
								</h:panelGroup>
							 </f:facet>
												
						</h:panelGrid>															
					</div>					
				</div>
											

				<h:panelGroup styleClass="box box-100 altbox" rendered="#{receiptsBean.showTable}">				
					<div class="boxin">
						<div class="content">
							<h:dataTable value="#{receiptsBean.receiptsViewList}" var="row">				
								<h:column>		
									<f:facet name="header"></f:facet>									 	
									 	<ul class="actions">
									 		<li>
									 			<h:commandLink styleClass="ico" action="#{receiptsBean.deleteReceiptsAction}" onclick="return confirm('Eliminar Ingreso?');">	
											 		<f:param name="id" value="#{row.id}" />	
											 		<h:graphicImage value="resources/images/led-ico/delete.png" alt="Eliminar Ingreso" style="border:0;" />						 							 	
											 	</h:commandLink>
									 		</li>
									 		<li>
											 	<h:commandLink styleClass="ico" action="#{receiptsBean.goEditReceipts}">	
											 		<f:param name="receiptId" value="#{row.id}" />	
											 		<h:graphicImage value="resources/images/led-ico/pencil.png" alt="Modificar Ingreso" style="border:0;" />						 							 	
											 	</h:commandLink>
									 		</li>
									 	</ul>								
								</h:column>
								
								<h:column>		
									<f:facet name="header"> <h:outputLabel value="Fecha" /></f:facet>		
									#{row.date}
								</h:column>					
							
								<h:column>
									<f:facet name="header"><h:outputLabel value="Concepto de Ingreso" /></f:facet>
									#{row.receiptsItemView.description}
								</h:column>
							
								<h:column>
									<f:facet name="header"><h:outputLabel value="Comentarios" /></f:facet>
									#{row.comments}
								</h:column>
							
								<h:column>
									<f:facet name="header"><h:outputLabel value="Casa" /></f:facet>
									#{row.condominiumsView.houseNumber}
								</h:column>
								
								<h:column>
									<f:facet name="header"><h:outputLabel value="Importe" /></f:facet>
									#{row.amount}
								</h:column>									
								
								<f:facet name="footer">
									<div style="text-align:right">
										TOTAL : #{receiptsBean.total}&nbsp;&nbsp;&nbsp;
									</div>						
								 </f:facet>
				
							</h:dataTable>							
						</div>						
					</div>
				</h:panelGroup>																
			</h:form>			
	</ui:define>
    
</ui:composition>